#include "BrokerMediator.h"
#include "broker/server/service/AbstractRequestService.h"
namespace zeroplus::mq
{

    BrokerMediator::BrokerMediator()
    {
    }

    void BrokerMediator::Notify(const ServiceType &sender, const Bytes &data)
    {
        switch (sender)
        {
        case PublishService:
        {
            serviceTable_[ServiceType::SubscribeService]->InternalReceive(sender, data);
            break;
        }
        case SubscribeService:
        {
            break;
        }
        case AdministrationService:
        {
            break;
        }
        case ReceiveService:
        {
            break;
        }
        default:
        {
            break;
        }
        }
    }

    void BrokerMediator::AddService(const ServiceType &type, std::shared_ptr<AbstractRequestService> requestService)
    {
        serviceTable_[type] = requestService;
    }

}